package com.morehair.controller.admin;

import com.morehair.bean.bo.admin.*;
import com.morehair.bean.vo.admin.*;
import com.morehair.service.admin.UserService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("admin")
@Transactional
public class UserController {

    @Autowired
    UserService userService;

    @RequestMapping("user/list")
    @RequiresPermissions("admin:user:list")
    public BaseRespVo userList(UserBo user) {
          UserDataVo userDataVo =  userService.selectUserData(user);
          return  BaseRespVo.ok(userDataVo);
    }

    @RequestMapping("address/list")
    @RequiresPermissions("admin:address:list")
    public BaseRespVo addressList(AddressBo user) {
        AddressDataVo addressDataVo =  userService.selectAddressData(user);
        return  BaseRespVo.ok(addressDataVo);
    }

    @RequestMapping("collect/list")
    @RequiresPermissions("admin:collect:list")
    public BaseRespVo collectList(CollectBo user) {
        CollectDataVo collectDataVo =  userService.selectCollectData(user);
        return  BaseRespVo.ok(collectDataVo);
    }

    @RequestMapping("footprint/list")
    @RequiresPermissions("admin:footprint:list")
    public BaseRespVo footprintList(FootprintBo user) {
        FootprintDataVo footprinttDataVo =  userService.selectFootprintData(user);
        return  BaseRespVo.ok(footprinttDataVo);
    }

    @RequestMapping("feedback/list")
    @RequiresPermissions("admin:feedback:list")
    public BaseRespVo feedbackList(FeedbackBo user) {
        FeedbackDataVo feedbackDataVo =  userService.selectFeedbackData(user);
        return  BaseRespVo.ok(feedbackDataVo);
    }

    @RequestMapping("history/list")
    @RequiresPermissions("admin:history:list")
    public BaseRespVo historyList(HistoryBo user) {
        HistoryDataVo historyDataVo =  userService.selectHistoryData(user);
        return  BaseRespVo.ok(historyDataVo);
    }
}
